home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / amigaoscd / amigapluscd / AP-Website / forum / wbboard / mod.php < prev    next >
Text File  |  2001-11-18  |  9KB  |  169 lines

  1. <? 
  2. require("_functions.php");
  3. require("_header.php");
  4.  
  5. $thread_info = $db_zugriff->query_first("SELECT * FROM bb".$n."_threads WHERE threadid = '$threadid'");
  6. if($boardid != $thread_info[boardparentid]) { 
  7.     echo $boardid."--".$thread_info[boardparentid];
  8.     eval("dooutput(\"".gettemplate("hack_error")."\");");
  9.     exit;
  10. }
  11.     if($action == -1) {
  12.         eval ("\$output = \"".gettemplate("error2")."\";");    
  13.         eval("dooutput(\"".gettemplate("action_error")."\");");
  14.     }
  15.     
  16. if($action == "polledit") {
  17.         
  18.     if($userdata[issupermod] || check_boardobject($boardid, $userid, "mod")) {
  19.         $ptitle = prepare_topic($thread_info[pquestion]);
  20.         $result = $db_zugriff->query("SELECT * FROM bb".$n."_poll WHERE threadid = '$threadid'");
  21.         $j=0;
  22.         while($row = $db_zugriff->fetch_array($result)) {
  23.             $j++;
  24.             $row[field] = prepare_topic($row[field]);
  25.             eval ("\$fields .= \"".gettemplate("mod_pollbit")."\";");
  26.         }
  27.         eval("dooutput(\"".gettemplate("mod_polledit")."\");");    
  28.     }
  29.     else header("LOCATION: misc.php?action=access_error$session");    
  30. }
  31.     
  32. if($action == "polledit_write") {
  33.     if($userdata[issupermod] || check_boardobject($boardid, $userid, "mod")) {
  34.         if($delete) {
  35.             $db_zugriff->query("UPDATE bb".$n."_threads SET pquestion = '', ptimeout = 0 WHERE threadid = '$threadid'");
  36.             $db_zugriff->query("DELETE FROM bb".$n."_poll WHERE threadid = '$threadid'");
  37.             $db_zugriff->query("DELETE FROM bb".$n."_vote WHERE threadid = '$threadid'");
  38.             header("LOCATION: thread.php?threadid=$threadid&boardid=$boardid$session");
  39.             exit;
  40.         }
  41.         elseif($ptitle && count($pfield)>=2) {
  42.             $db_zugriff->query("UPDATE bb".$n."_threads SET pquestion = '".trim($ptitle)."', ptimeout = '$ptimeout' WHERE threadid = '$threadid'");
  43.             while(list($key,$val) = each($pfield)) $db_zugriff->query("UPDATE bb".$n."_poll SET field = '$val' WHERE id = '$key'");
  44.             header("LOCATION: thread.php?threadid=$threadid&boardid=$boardid$session");
  45.             exit;    
  46.         }
  47.         else {
  48.             eval ("\$output = \"".gettemplate("error3")."\";");
  49.             eval("dooutput(\"".gettemplate("action_error")."\");");
  50.             exit;
  51.         }    
  52.     }
  53.     else header("LOCATION: misc.php?action=access_error$session");    
  54.     
  55. if($action == "close") {
  56.     if(check_boardobject($boardid,$user_id,"mod") || $userdata[issupermod] || ($thread_info[authorid] && $thread_info[authorid]==$user_id && $userdata[cancloseowntopic])) {
  57.         if($thread_info[flags]) {
  58.             $db_zugriff->query("UPDATE bb".$n."_threads SET flags='0' WHERE threadid='$threadid'");        
  59.             eval ("\$output = \"".gettemplate("mod_note9")."\";");
  60.             $ride = "thread.php?threadid=$threadid&boardid=$boardid&styleid=$styleid$session";
  61.         }
  62.         else {
  63.             $db_zugriff->query("UPDATE bb".$n."_threads SET flags='1' WHERE threadid='$threadid'");
  64.             eval ("\$output = \"".gettemplate("mod_note10")."\";");
  65.             $ride = "thread.php?threadid=$threadid&boardid=$boardid&styleid=$styleid$session";
  66.         }
  67.         eval("dooutput(\"".gettemplate("action_ride")."\");");    
  68.     }
  69.     else header("LOCATION: misc.php?action=access_error&boardid=$boardid&styleid=$styleid$session");
  70. }
  71.  
  72. if($action == "move") {
  73.     if((check_boardobject($boardid,$user_id,"mod") && $userdata[ismod]) || $userdata[issupermod]) {
  74.         if($send == "send") {
  75.             if($copy) $db_zugriff->query("UPDATE bb".$n."_threads SET boardparentid='$newboardid', putoffid='$putoffid' WHERE threadid='$threadid'");        
  76.             else $db_zugriff->query("UPDATE bb".$n."_threads SET boardparentid='$newboardid', putoffid='0' WHERE threadid='$threadid'");
  77.             $db_zugriff->query("UPDATE bb".$n."_posts SET boardparentid='$newboardid' WHERE threadparentid='$threadid'");    
  78.             
  79.             $pinfo = $db_zugriff->query_first("SELECT postid, posttime FROM bb".$n."_posts WHERE boardparentid = '$putoffid' ORDER BY posttime DESC LIMIT 1");
  80.                     $db_zugriff->query("UPDATE bb".$n."_boards SET threads=threads-1, posts=posts-".($thread_info[replies]+1).", lastposttime = '$pinfo[posttime]', lastpostid = '$pinfo[postid]' WHERE boardid = '$putoffid'");
  81.                     
  82.                     $pinfo = $db_zugriff->query_first("SELECT postid, posttime FROM bb".$n."_posts WHERE boardparentid = '$newboardid' ORDER BY posttime DESC LIMIT 1");
  83.                     $db_zugriff->query("UPDATE bb".$n."_boards SET threads=threads+1, posts=posts+".($thread_info[replies]+1).", lastposttime = '$pinfo[posttime]', lastpostid = '$pinfo[postid]' WHERE boardid = '$newboardid'");
  84.                 
  85.                         eval ("\$output = \"".gettemplate("mod_note11")."\";");
  86.             $ride = "thread.php?threadid=$threadid&boardid=$newboardid&styleid=$styleid$session";
  87.             eval("dooutput(\"".gettemplate("action_ride")."\");");
  88.             exit;
  89.         }
  90.         $board_result = $db_zugriff->query("SELECT boardid, boardname FROM bb".$n."_boards WHERE boardid<>$boardid AND isboard = 1 ORDER BY boardname ASC");
  91.         while($boards = $db_zugriff->fetch_array($board_result)) {
  92.             $select .= "<option value=\"$boards[boardid]\">$boards[boardname]</option>";
  93.         }
  94.         $db_zugriff->free_result($board_result);
  95.         eval("dooutput(\"".gettemplate("mod_move")."\");");
  96.     }
  97.     else header("LOCATION: misc.php?action=access_error&boardid=$boardid&styleid=$styleid$session");
  98. }
  99.     
  100. if($action == "del") {
  101.     if((check_boardobject($boardid,$user_id,"mod") && $userdata[ismod]) || $userdata[issupermod] || ($thread_info[authorid] && $thread_info[authorid]==$user_id && $userdata[candelowntopic])) {
  102.         if($send == "send") {
  103.             $post_result = $db_zugriff->query("SELECT userid FROM bb".$n."_posts WHERE threadparentid='$threadid'");
  104.             while($row = $db_zugriff->fetch_array($post_result)) {
  105.                 delUserposts($row[userid]);
  106.             }
  107.             $db_zugriff->query("DELETE FROM bb".$n."_threads WHERE threadid='$threadid'");
  108.                     $db_zugriff->query("DELETE FROM bb".$n."_posts WHERE threadparentid='$threadid'");
  109.                     $db_zugriff->query("DELETE FROM bb".$n."_notify WHERE threadid='$threadid'");
  110.                     $db_zugriff->query("DELETE FROM bb".$n."_poll WHERE threadid='$threadid'");
  111.                     $db_zugriff->query("DELETE FROM bb".$n."_vote WHERE threadid='$threadid'");
  112.                     $db_zugriff->query("DELETE FROM bb".$n."_object2user WHERE objectid='$threadid' AND favthreads = 1");
  113.         
  114.             $pinfo = $db_zugriff->query_first("SELECT postid, posttime FROM bb".$n."_posts WHERE boardparentid = '$boardid' ORDER BY posttime DESC LIMIT 1");
  115.                     $db_zugriff->query("UPDATE bb".$n."_boards SET threads=threads-1, posts=posts-".($thread_info[replies]+1).", lastposttime = '$pinfo[posttime]', lastpostid = '$pinfo[postid]' WHERE boardid = '$boardid'");
  116.                 
  117.                     eval ("\$output = \"".gettemplate("mod_note12")."\";");
  118.             $ride = "board.php?boardid=$boardid&styleid=$styleid$session";
  119.             eval("dooutput(\"".gettemplate("action_ride")."\");");
  120.         }
  121.         else eval("dooutput(\"".gettemplate("mod_del")."\");");
  122.     }
  123.     else header("LOCATION: misc.php?action=access_error&boardid=$boardid&styleid=$styleid$session");
  124. }
  125.  
  126. if($action == "top") {
  127.     if($userdata[issupermod] || ($userdata[ismod] && check_boardobject($boardid,$user_id,"mod"))) {
  128.         if($thread_info[important]) {
  129.             $db_zugriff->query("UPDATE bb".$n."_threads SET important='0' WHERE threadid='$threadid'");        
  130.             eval ("\$output = \"".gettemplate("mod_note14")."\";");
  131.             $ride = "thread.php?threadid=$threadid&boardid=$boardid&styleid=$styleid$session";
  132.         }
  133.         else {
  134.             $db_zugriff->query("UPDATE bb".$n."_threads SET important='1' WHERE threadid='$threadid'");
  135.             eval ("\$output = \"".gettemplate("mod_note13")."\";");
  136.             $ride = "thread.php?threadid=$threadid&boardid=$boardid&styleid=$styleid$session";
  137.         }
  138.         eval("dooutput(\"".gettemplate("action_ride")."\");");
  139.     }
  140.     else header("LOCATION: misc.php?action=access_error&boardid=$boardid&styleid=$styleid$session");
  141. }
  142.  
  143. if($action == "threadedit") {
  144.     if($userdata[issupermod] || ($userdata[ismod] && check_boardobject($boardid,$user_id,"mod"))) {
  145.         if($send == "send" && $subject = trim($subject)) {
  146.             $db_zugriff->query("UPDATE bb".$n."_threads SET threadname = '".editPostdata($subject)."', topicicon = '$posticon' WHERE threadid = '$threadid'");
  147.             header("Location: thread.php?threadid=$threadid&boardid=$boardid$session");
  148.             exit;
  149.         }
  150.         $thread_info = $db_zugriff->query_first("SELECT * FROM bb".$n."_threads WHERE threadid = '$threadid'");
  151.         $subject = prepare_topic($thread_info[threadname]);
  152.         
  153.         include("templates/posticons.php");
  154.         for($i = 0; $i < count($posticons); $i++) {
  155.             if(is_int($i/6) && $i) $choice_posticons .= "<br>";
  156.             elseif($i) $choice_posticons .= "    ";
  157.             $choice_posticons .= "<INPUT type=\"radio\" name=\"posticon\" value=\"$posticons[$i]\"";
  158.             if($thread_info[topicicon] == $posticons[$i]) $choice_posticons .= " CHECKED";
  159.             $choice_posticons .= ">  <img src=\"$posticons[$i]\">";
  160.         }
  161.         if(!$thread_info[topicicon]) $noicon[0] = "CHECKED"; 
  162.         
  163.         eval("dooutput(\"".gettemplate("mod_threadedit")."\");");
  164.     }
  165.     else header("LOCATION: misc.php?action=access_error&boardid=$boardid&styleid=$styleid$session");
  166. }
  167. ?>
  168.